package com.han.nettytestdemo.connector.netty.client;


import com.han.nettytestdemo.connector.LogUtil;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class JsonStocktakingEncoder extends MessageToByteEncoder<String> {

    @Override
    protected void encode(ChannelHandlerContext ctx, String user, ByteBuf buf) {
        LogUtil.e(ClientHandler.TAG, "encode" + user);
//        String json = JsonUtil.toJSON(user);
        try {
//            byte[] sd = CRC16M.HexString2Buf(user.trim());
//            ByteBuf byteBuf = Unpooled.wrappedBuffer(sd);
            ctx.writeAndFlush(user);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
